#pragma once

#include <shlobj.h>
#include <list>
#include <gdiplus.h>
#include "DesktopSorter.h"

using namespace std;

class ExplorerController
{
public:
	ExplorerController();
	virtual ~ExplorerController();

	void SetExplorerHwnd(HWND explorerHwnd);
	void SetSitePtr(CComPtr<IUnknown> spUnkSite);	

	bool InvertFilesSelection();
	bool RefreshFolderView();
	bool GetSelectedItemsPath(list<wstring>& itemsList);
	bool SelectItemsByPathList(const list<wstring>& itemsList);
	bool SortItemsByPathList(DesktopSortConfig& desktopSortConfig,  bool clearLastDesktop = true, bool silentMode = false);
	bool SortItemsByPathListWithLastConfig(bool silentMode = false);

private:
	static HWND s_ListHwnd;

	HWND m_ExplorerHwnd;
	IShellBrowser* m_pShellBrowser;
	IShellView* m_pShellView;
	IFolderView* m_pFolderView;

	static BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam);

	void ReleaseComPointers();
};
